package com.bruce.pattern.structural.composite;

import lombok.extern.slf4j.Slf4j;

/**
 * Created by bruce on 2018/11/5 22:55
 */
public class Course extends CatalogComponent {

    private String name;
    private double price;

    public Course(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String getName(CatalogComponent catalogComponent) {
        return name;
    }

    @Override
    public double getPrice(CatalogComponent catalogComponent) {
        return this.price;
    }

    @Override
    public void print() {
        System.out.println("课程:" + name);
    }
}
